﻿using System;
using System.Web;
using System.Net.Mail;
using System.Web.UI;
using SimplePMT.Data;
using SimplePMT.Control;
using System.Text;
using System.Collections.Generic;
using Castle.ActiveRecord;
using NHibernate.Expression;
using SimplePMT.Components;

namespace SimplePMT
{
    public partial class ReportIteration : Components.BasePage
    {
        public string StartDate = string.Empty;
        public string EndDate = string.Empty;
        public string onLoadReport = string.Empty;

        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(ReportIteration), this.Page);
            ValidateSession();

            if (Request.QueryString["start"] != null && Request.QueryString["end"] != null)
            {
                StartDate = Request.QueryString["start"];
                EndDate = Request.QueryString["end"];
                onLoadReport = LoadReport(StartDate, EndDate);
            }
        }

        [AjaxPro.AjaxMethod()]
        public string LoadReport(string fromDate, string toDate)
        {
            Control.ReportIterationControl view = this.LoadControl("./Control/ReportIterationControl.ascx") as Control.ReportIterationControl;
            view.FromDate = fromDate;
            view.ToDate = toDate;
            return view.ToString();
        }

    }
}
